use zmath::{Mat4, Vec4, Vec3};

pub enum GLUniform {
    Int(i32),
    Float(f32),
    Bool(bool),
    Mat4([f32; 16]),
    Vec4([f32; 4]),
    Vec3([f32; 3])
}

pub trait AsGLUniform {
    fn as_gl_uniform(&self) -> GLUniform;
}

impl AsGLUniform for Mat4 {
    fn as_gl_uniform(&self) -> GLUniform {
        GLUniform::Mat4(self.to_array())
    }
}

impl AsGLUniform for Vec4 {
    fn as_gl_uniform(&self) -> GLUniform {
        GLUniform::Vec4(self.to_array())
    }
}

impl AsGLUniform for Vec3 {
    fn as_gl_uniform(&self) -> GLUniform {
        GLUniform::Vec3(self.to_array())
    }
}

impl AsGLUniform for f32 {
    fn as_gl_uniform(&self) -> GLUniform {
        GLUniform::Float(*self)
    }
}

impl AsGLUniform for bool {
    fn as_gl_uniform(&self) -> GLUniform {
        GLUniform::Bool(*self)
    }
}

impl AsGLUniform for i32 {
    fn as_gl_uniform(&self) -> GLUniform {
        GLUniform::Int(*self)
    }
}